<!DOCTYPE html>

<html>
<head>
  <title>baseList.coffee</title>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
  <link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
  <div id="container">
    <div id="background"></div>
    
      <ul id="jump_to">
        <li>
          <a class="large" href="javascript:void(0);">Jump To &hellip;</a>
          <a class="small" href="javascript:void(0);">+</a>
          <div id="jump_wrapper">
          <div id="jump_page">
            
              
              <a class="source" href="app.html">
                app.coffee
              </a>
            
              
              <a class="source" href="appInstance.html">
                appInstance.coffee
              </a>
            
              
              <a class="source" href="appMessages.html">
                appMessages.coffee
              </a>
            
              
              <a class="source" href="appSettings.html">
                appSettings.coffee
              </a>
            
              
              <a class="source" href="baseList.html">
                baseList.coffee
              </a>
            
              
              <a class="source" href="baseModel.html">
                baseModel.coffee
              </a>
            
              
              <a class="source" href="countdown.html">
                countdown.coffee
              </a>
            
              
              <a class="source" href="countdownList.html">
                countdownList.coffee
              </a>
            
              
              <a class="source" href="eggTimer.html">
                eggTimer.coffee
              </a>
            
              
              <a class="source" href="scheduledTwitter.html">
                scheduledTwitter.coffee
              </a>
            
              
              <a class="source" href="aboutView.html">
                aboutView.coffee
              </a>
            
              
              <a class="source" href="baseView.html">
                baseView.coffee
              </a>
            
              
              <a class="source" href="countdownChristmasView.html">
                countdownChristmasView.coffee
              </a>
            
              
              <a class="source" href="countdownView.html">
                countdownView.coffee
              </a>
            
              
              <a class="source" href="eggTimerView.html">
                eggTimerView.coffee
              </a>
            
              
              <a class="source" href="indexView.html">
                indexView.coffee
              </a>
            
              
              <a class="source" href="statsView.html">
                statsView.coffee
              </a>
            
          </div>
        </li>
      </ul>
    
    <ul class="sections">
        
          <li id="title">
              <div class="annotation">
                  <h1>baseList.coffee</h1>
              </div>
          </li>
        
        
        
        <li id="section-1">
            <div class="annotation">
              
              <div class="pilwrap for-h2">
                <a class="pilcrow" href="#section-1">&#182;</a>
              </div>
              <h2>BASE LIST</h2>

            </div>
            
        </li>
        
        
        <li id="section-2">
            <div class="annotation">
              
              <div class="pilwrap ">
                <a class="pilcrow" href="#section-2">&#182;</a>
              </div>
              <p>This serves as the base for all lists.</p>

            </div>
            
            <div class="content"><div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">BaseList</span></span>

    id: <span class="number">0</span></pre></div></div>
            
        </li>
        
        
        <li id="section-3">
            <div class="annotation">
              
              <div class="pilwrap ">
                <a class="pilcrow" href="#section-3">&#182;</a>
              </div>
              <p>Holds the URL used to load and save data. Loading will use a GET request,
and saving will use a POST request.</p>

            </div>
            
            <div class="content"><div class='highlight'><pre>    url: <span class="literal">null</span></pre></div></div>
            
        </li>
        
        
        <li id="section-4">
            <div class="annotation">
              
              <div class="pilwrap ">
                <a class="pilcrow" href="#section-4">&#182;</a>
              </div>
              <p>Holds the date of the last succesful save call on the server.</p>

            </div>
            
            <div class="content"><div class='highlight'><pre>    lastSave: <span class="literal">null</span></pre></div></div>
            
        </li>
        
        
        <li id="section-5">
            <div class="annotation">
              
              <div class="pilwrap ">
                <a class="pilcrow" href="#section-5">&#182;</a>
              </div>
              <p>Holds the date of the last succesful load call on the server.</p>

            </div>
            
            <div class="content"><div class='highlight'><pre>    lastLoad: <span class="literal">null</span></pre></div></div>
            
        </li>
        
        
        <li id="section-6">
            <div class="annotation">
              
              <div class="pilwrap ">
                <a class="pilcrow" href="#section-6">&#182;</a>
              </div>
              <p>Object which holds all the models.</p>

            </div>
            
            <div class="content"><div class='highlight'><pre>    models: <span class="keyword">new</span> Array()</pre></div></div>
            
        </li>
        
        
        <li id="section-7">
            <div class="annotation">
              
              <div class="pilwrap for-h2">
                <a class="pilcrow" href="#section-7">&#182;</a>
              </div>
              <h2>ADDING AND REMOVING</h2>

            </div>
            
        </li>
        
        
        <li id="section-8">
            <div class="annotation">
              
              <div class="pilwrap ">
                <a class="pilcrow" href="#section-8">&#182;</a>
              </div>
              <p>Add a single model to the list.</p>

            </div>
            
            <div class="content"><div class='highlight'><pre>    add: (model, bypassDuplicateCheck) =&gt;
        <span class="keyword">if</span> bypassDuplicateCheck
            <span class="property">@models</span>.push add</pre></div></div>
            
        </li>
        
        
        <li id="section-9">
            <div class="annotation">
              
              <div class="pilwrap ">
                <a class="pilcrow" href="#section-9">&#182;</a>
              </div>
              <p>Remove the specified model from the list.</p>

            </div>
            
            <div class="content"><div class='highlight'><pre>    remove: (model) =&gt;
        <span class="keyword">for</span> item <span class="keyword">in</span> <span class="property">@models</span>
            <span class="keyword">if</span> item.id <span class="keyword">is</span> model.id
                <span class="property">@models</span>.splice item</pre></div></div>
            
        </li>
        
        
        <li id="section-10">
            <div class="annotation">
              
              <div class="pilwrap for-h2">
                <a class="pilcrow" href="#section-10">&#182;</a>
              </div>
              <h2>SERVER SYNC</h2>

            </div>
            
        </li>
        
        
        <li id="section-11">
            <div class="annotation">
              
              <div class="pilwrap ">
                <a class="pilcrow" href="#section-11">&#182;</a>
              </div>
              <p>Save the model to the server.</p>

            </div>
            
            <div class="content"><div class='highlight'><pre>    save: =&gt;
        alert <span class="number">4</span></pre></div></div>
            
        </li>
        
        
        <li id="section-12">
            <div class="annotation">
              
              <div class="pilwrap ">
                <a class="pilcrow" href="#section-12">&#182;</a>
              </div>
              <p>Load the model&#39;s data and attributes from the server.</p>

            </div>
            
            <div class="content"><div class='highlight'><pre>    load: =&gt;
        alert <span class="number">5</span></pre></div></div>
            
        </li>
        
        
        <li id="section-13">
            <div class="annotation">
              
              <div class="pilwrap ">
                <a class="pilcrow" href="#section-13">&#182;</a>
              </div>
              <p>Module exports (only necessary on the server side).</p>

            </div>
            
            <div class="content"><div class='highlight'><pre><span class="keyword">if</span> exports?
    module.exports = BaseList
<span class="keyword">else</span>
    window.App.BaseList = BaseList</pre></div></div>
            
        </li>
        
    </ul>
  </div>
</body>
</html>
